Skip Headers

Oracle® Spatial GeoRaster 10g Release 2 (10.2) Part Number B14254-02 |
Home | Book List | Contents | Index | Master Index | Feedback

Previous | Next
| View PDF

# 2 GeoRaster Data Types and Related Structures

The object-relational implementation of GeoRaster consists of a set of object data types for storing data and system data. Each image or gridded raster data is stored in a column of type SDO_GEORASTER, and the blocks in that raster data are stored in a raster data table of type SDO_RASTER, as explained and illustrated in Section 1.4. This chapter contains the following major sections:

- Section 2.1, "SDO_GEORASTER Object Type"

- Section 2.2, "SDO_RASTER Object Type and the Raster Data Table"

- Section 2.3, "Other GeoRaster Types"

- Section 2.4, "GeoRaster System Data Views (xxx_SDO_GEOR_SYSDATA)"

- Section 2.5, "GeoRaster XML Schema Table"

## 2.1 SDO_GEORASTER Object Type

In the GeoRaster object-relational model, a raster image or grid object is stored in a single row, in a single column of object type SDO_GEORASTER in a user-defined table. Tables with one or more columns of type SDO_GEORASTER are referred to as GeoRaster tables.

The SDO_GEORASTER object type is defined as:

    CREATE TYPE sdo_georaster AS OBJECT (
     rasterType       NUMBER,
     spatialExtent    SDO_GEOMETRY,
     rasterDataTable  VARCHAR2(32),
     rasterID         NUMBER,
     metadata         XMLType);

The sections that follow describe the semantics of each SDO_GEORASTER attribute.

### 2.1.1 rasterType Attribute

The `rasterType` attribute must be a 5-digit number in the format `[d][b][t][gt]`, where:

- `[d]` identifies the number of spatial dimensions. Must be 2 for the current release.

- `[b]` indicates band or layer information: 0 means one band or layer; 1 means one or more than one band or layer. Note that you are not specifying the total number of bands or layers in this field. (For information about bands and layers, see Section 1.5.)

- `[t]` is reserved for future use and should be specified as 0 (zero).

- `[gt]` identifies the 2-digit GeoRaster type, and must be one of the following values:

  [gt] Value | Meaning
  --- | ---
  00 | Reserved for Oracle use.
  01 | Any GeoRaster type. This is the only value supported for the current release. This value causes GeoRaster not to apply any restrictions associated with specific types that might be implemented in future releases.
  02-50 | Reserved for Oracle use.
  51-99 | Reserved for customer use in future releases.

For example, a RasterType value of 20001 means:

- Two-dimensional data

- One band (layer)

- Any GeoRaster type

### 2.1.2 spatialExtent Attribute

The `spatialExtent` attribute identifies the spatial extent, or footprint, associated with the raster data. The spatial extent is an Oracle Spatial geometry of type SDO_GEOMETRY. The spatial extent geometry can be in any coordinate system; however, it is in the model (ground) space of the GeoRaster object if the GeoRaster object is georeferenced and if you generate the spatial extent geometry using any of the following methods: calling the SDO_GEOR.generateSpatialExtent function, or specifying `spatialExtent=TRUE` as a storage parameter to the SDO_GEOR.importFrom procedure or the GeoRaster client-side loader (described in Section 1.10). The spatial extent is set to null, rather than cell space, if its SRID value is null or 0 (zero). The SDO_GEOMETRY data type is described in Oracle Spatial User's Guide and Reference.

Because of the potential performance benefits of spatial indexing for GeoRaster applications, the geometry is associated with the `spatialExtent` attribute, rather than being included in the XML `metadata` attribute described in Section 2.1.5. For information about indexing GeoRaster data, see Section 3.8.

### 2.1.3 rasterDataTable Attribute

The `rasterDataTable` attribute identifies the name of the raster data table. The raster data table must be an object table of type SDO_RASTER. It contains a row of type SDO_RASTER for each raster block that is stored. You must create and (if necessary) drop the raster data table. You should never modify the rows in this table directly, but you can query this table to access the raster data.

For more information about the raster data table and the SDO_RASTER type, see Section 2.2.

### 2.1.4 rasterID Attribute

The `rasterID` attribute value is stored in the rows of the raster data table to identify which rows belong to the GeoRaster object. The `rasterDataTable` attribute and `rasterID` attribute together uniquely identify the GeoRaster object in the database. That is, each GeoRaster object has a raster data table, although a raster data table can contain data from multiple GeoRaster objects.

You can specify the `rasterID` and `rasterDataTable` attributes for new GeoRaster objects, as long as each pair is unique in the database. If you do not specify these values, they are automatically generated by the SDO_GEOR.init and SDO_GEOR.createBlank functions.

### 2.1.5 metadata Attribute

The `metadata` attribute contains the GeoRaster metadata that is defined by Oracle. The metadata is described by the GeoRaster metadata XML schema, which is documented in Appendix A. The metadata of any GeoRaster object must be validated against this XML schema, and it must also be validated using the SDO_GEOR.validateGeoraster function, which imposes additional restrictions not defined by this XML schema.

## 2.2 SDO_RASTER Object Type and the Raster Data Table

In the GeoRaster object-relational model, a raster data table is used to store all cell data in a raster image. The cell data of a GeoRaster object is blocked, and each block is stored in the raster data table as one row. You specify this table in the `rasterDataTable` attribute of the SDO_GEORASTER object, as explained in Section 2.1.3. You must create the raster data table before you store any cell data in it.

The raster data table is an object table, defined as a table of SDO_RASTER object type. The SDO_RASTER object type is defined as:

    CREATE TYPE sdo_raster AS OBJECT (
     rasterID           NUMBER,
     pyramidLevel       NUMBER,
     bandBlockNumber    NUMBER,
     rowBlockNumber     NUMBER,
     columnBlockNumber  NUMBER,
     blockMBR           SDO_GEOMETRY,
     rasterBlock        BLOB);

The sections that follow describe the semantics of each SDO_RASTER attribute.

### 2.2.1 rasterID Attribute

The `rasterID` attribute in the SDO_RASTER object must be a number that matches the `rasterID` value in its associated SDO_GEORASTER object. (The `rasterID` attribute of the SDO_GEORASTER object is described in Section 2.1.4.) The matching of these numbers identifies the raster block as belonging to a specific GeoRaster object.

### 2.2.2 pyramidLevel Attribute

The `pyramidLevel` attribute identifies the pyramid level for this block of cells. The pyramid level is 0 or any positive integer. Pyramid levels are used to create reduced resolution images that require less storage space. A pyramid level of 0 indicates the original raster data; that is, there is no reduction in the image resolution and no change in the storage space required. Values greater than 0 (zero) indicate increasingly reduced levels of image resolution and reduced storage space requirements. For more information about pyramids, see Section 1.7.

### 2.2.3 bandBlockNumber Attribute

The `bandBlockNumber` attribute identifies the block number along the band dimension. (For information about bands and layers, see Section 1.5.)

### 2.2.4 rowBlockNumber Attribute

The `rowBlockNumber` attribute identifies the block number along the row dimension.

### 2.2.5 columnBlockNumber Attribute

The `columnBlockNumber` attribute identifies the block number along the column dimension.

### 2.2.6 blockMBR Attribute

The `blockMBR` attribute is the geometry (of type SDO_GEOMETRY) for the minimum bounding rectangle (MBR) for this block. The geometry is in cell space (that is, its SRID value is null), and all ordinates are integers. The ordinates represent the minimum row and column and the maximum row and column stored in this block.

### 2.2.7 rasterBlock Attribute

The `rasterBlock` attribute contains all raster cell data for this block. The `rasterBlock` attribute is of type BLOB.

## 2.3 Other GeoRaster Types

In addition to SDO_GEORASTER (described in Section 2.1) and SDO_RASTER (described in Section 2.2), GeoRaster provides several other object and collection types, which are used for specific kinds of operations. Unlike the SDO_GEORASTER and SDO_RASTER types, which are used for storage in the database (for example, to define a column in a table), the types described in this section are used only with the GeoRaster PL/SQL API in the current release.

### 2.3.1 SDO_GEOR_HISTOGRAM Object Type

The SDO_GEOR_HISTOGRAM object type is used to contain the histogram data of a GeoRaster object or a layer. Each cell has a value, and for each cell value there may be any number of cells having that value. The histogram contains the cell values and the total number of cells related to each cell value.

The SDO_GEOR_HISTOGRAM object type is defined as:

    CREATE TYPE sdo_geor_histogram AS OBJECT(
      cellValue  SDO_NUMBER_ARRAY,
      count      SDO_NUMBER_ARRAY);

Table 2-1 describes the attributes of the SDO_GEOR_HISTOGRAM object type. The `cellValue` array and the `count` array must have the same length.

Table 2-1 SDO_GEOR_HISTOGRAM Object Type Attributes

Attribute | Description
--- | ---
cellValue | Array of cell values.
count | Number of cells that correspond to each value in `cellValue`.

### 2.3.2 SDO_GEOR_COLORMAP Object Type

The SDO_GEOR_COLORMAP object type contains colormap information, that is, pseudocolor information for identifying the red, green, blue, and (optionally) alpha values of the color to be used to display cells that have a specific value. The colormap is also called the pseudocolor table or the palette table. The colormap in GeoRaster is in the default sRGB ColorSpace, which is a proposed standard RGB color space, as explained at

`http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html`

The ranges for red, green, blue, and alpha values are all scaled to be 8-bit unsigned integers from 0 to 255.

Alpha is also called opacity. An alpha value of 255 means that the color is completely opaque, and an alpha value of 0 means that the color is completely transparent. The color component values are never premultiplied by the alpha value.

The SDO_GEOR_COLORMAP object type is defined as:

    CREATE TYPE sdo_geor_colormap AS OBJECT(
      cellValue  SDO_NUMBER_ARRAY,
      red        SDO_NUMBER_ARRAY,
      green      SDO_NUMBER_ARRAY,
      blue       SDO_NUMBER_ARRAY,
      alpha      SDO_NUMBER_ARRAY);

Table 2-2 describes the attributes of the SDO_GEOR_COLORMAP object type. Each attribute is an array of numbers. The arrays must have the same length, and the values of the same index in each array must correspond to each other. Each `cellValue` value must be consistent with the `cellDepth` value of the GeoRaster object.

Table 2-2 SDO_GEOR_COLORMAP Object Type Attributes

Attribute | Description
--- | ---
cellValue | Array of cell values.
red | Array of red component values for pseudocolor display of cells that have the values in `cellValue`. Must be integer values from 0 to 255.
green | Array of green component values for pseudocolor display of cells that have the values in `cellValue`. Must be integer values from 0 to 255.
blue | Array of blue component values for pseudocolor display of cells that have the values in `cellValue`. Must be integer values from 0 to 255.
alpha | Array of alpha component values for pseudocolor display of cells that have the values in `cellValue`. Must be integer values from 0 to 255.

### 2.3.3 SDO_GEOR_GRAYSCALE Object Type

The SDO_GEOR_GRAYSCALE object type contains grayscale information for identifying the grayscale value to be used to display cells that have a specific value. The grayscale table cell values can be "stretched" in linear proportion using this grayscale table, so that the original raster data can be properly displayed. The grayscale table value range is 8-bit unsigned integer values from 0 to 255. The grayscale table is also called the contrast table or the lookup table.

The SDO_GEOR_GRAYSCALE object type is defined as:

    CREATE TYPE sdo_geor_grayscale AS OBJECT(
      cellValue  SDO_NUMBER_ARRAY,
      gray       SDO_NUMBER_ARRAY);

Table 2-3 describes the attributes of the SDO_GEOR_GRAYSCALE object type. The `cellValue` array and the `gray` array must have the same length. Each `cellValue` value must be consistent with the `cellDepth` value of the GeoRaster object.

Table 2-3 SDO_GEOR_GRAYSCALE Object Type Attributes

Attribute | Description
--- | ---
cellValue | Array of cell values.
gray | Array of gray component values for grayscale display of cells that have the values in `cellValue`. Must be integer values from 0 to 255.

### 2.3.4 SDO_RASTERSET Collection Type

The SDO_RASTERSET collection type is used as the return type of table functions that query the raster data blocks (one or many blocks, the whole set or a subset).

The SDO_RASTERSET collection type is defined as:

    CREATE TYPE sdo_rasterset AS TABLE of SDO_RASTER;

The SDO_RASTER type is described in Section 2.2.

### 2.3.5 SDO_GEOR_SRS Object Type

The SDO_GEOR_SRS object type is used to contain information related to the spatial referencing of a GeoRaster object.

The SDO_GEOR_SRS object type is defined as:

    CREATE TYPE sdo_geor_srs AS OBJECT (
       isReferenced       VARCHAR2(5),
       isRectified        VARCHAR2(5),
       isOrthoRectified   VARCHAR2(5),
       srid               NUMBER,
       spatialResolution  SDO_NUMBER_ARRAY,
       spatialTolerance   NUMBER,
       coordLocation      NUMBER,
       rowOff             NUMBER,
       columnOff          NUMBER,
       xOff               NUMBER,
       yOff               NUMBER,
       zOff               NUMBER,
       rowScale           NUMBER,
       columnScale        NUMBER,
       xScale             NUMBER,
       yScale             NUMBER,
       zScale             NUMBER,
       rowRMS             NUMBER,
       columnRMS          NUMBER,
       totalRMS           NUMBER,
       rowNumerator       SDO_NUMBER_ARRAY,
       rowDenominator     SDO_NUMBER_ARRAY,
       columnNumerator    SDO_NUMBER_ARRAY,
       columnDenominator  SDO_NUMBER_ARRAY);

Table 2-4 describes the attributes of the SDO_GEOR_SRS object type.

Table 2-4 SDO_GEOR_SRS Object Type Attributes

Attribute | Description
--- | ---
isReferenced | `TRUE` if the GeoRaster object is georeferenced; `FALSE` if the GeoRaster object is not georeferenced.
isRectified | `TRUE` if the GeoRaster object is both georectified and georeferenced; `FALSE` if the GeoRaster object is not georectified.
isOrthoRectified | `TRUE` if the GeoRaster object is orthorectified, georectified, and georeferenced; `FALSE` if the GeoRaster object is not orthorectified.
srid | SRID value of the model (ground) coordinate system.
spatialResolution | Spatial resolution values: an array of numeric values, one for each spatial dimension. Each value indicates the number of units of measurement associated with the data area represented by that spatial dimension of a cell.
spatialTolerance | Tolerance value. (For an explanation of tolerance, see Oracle Spatial User's Guide and Reference.)
coordLocation | The model coordinate location representing either the upper-left corner or the center of each cell in the model space when cell coordinates (integer numbers) are converted to model coordinates (double numbers).
rowOff | Must be 0 (zero) for the current release.
columnOff | Must be 0 (zero) for the current release.
xOff | Must be 0 (zero) for the current release.
yOff | Must be 0 (zero) for the current release.
zOff | Must be 0 (zero) for the current release.
rowScale | Must be 1 for the current release.
columnScale | Must be 1 for the current release.
xScale | Must be 1 for the current release.
yScale | Must be 1 for the current release.
zScale | Must be 1 for the current release.
rowRMS | Must be NULL for the current release.
columnRMS | Must be NULL for the current release.
totalRMS | Must be NULL for the current release.
rowNumerator | `pType`, `nVars`, `order`, `nCoefficients`, and all coefficients of the numerator of the row polynomial, where pType=1, nVars=2, order=1, and nCoefficients=3. The three coefficients are `a`, `b`, `c` in the formulas in Section 1.6.1.
rowDenominator | `pType`, `nVars`, `order`, `nCoefficients`, and all coefficients of the denominator of the row polynomial, where pType=1, nVars=0, order=0, and nCoefficients=1. The value of the single coefficient must be 1 for the current release.
columnNumerator | `pType`, `nVars`, `order`, `nCoefficients`, and all coefficients of the numerator of the column polynomial, where pType=1, nVars=2, order=1, and nCoefficients=3. The three coefficients are `d`, `e`, `f` in the formulas in Section 1.6.1.
columnDenominator | `pType`, `nVars`, `order`, `nCoefficients`, and all coefficients of the denominator of the column polynomial, where pType=1, nVars=0, order=0, and nCoefficients=1. The value of the single coefficient must be 1 for the current release.

## 2.4 GeoRaster System Data Views (xxx_SDO_GEOR_SYSDATA)

GeoRaster uses a system data table to maintain the relationship between GeoRaster tables and their related raster data tables. Each GeoRaster object (if it is not null) has a related raster data table, and it might have other tables, such as ground control point (GCP) tables and value attribute tables (VATs).

For a given user, the raster data table name plus the `rasterID` uniquely identify a GeoRaster object. It is possible for many GeoRaster objects (each with a different `rasterID` value) in one GeoRaster table to share one raster data table.

Whenever a new GeoRaster object (including empty and blank GeoRaster objects) is created, a raster data table is assigned to it and a `rasterID` value is assigned. All SDO_GEORASTER objects (except atomic null objects) are automatically recorded in the system data table when they are created.

The GeoRaster system data table is under the MDSYS schema. Most of the information in the GeoRaster system data table is available for retrieval through system data views. Each GeoRaster user has the following system data views available in the schema associated with that user:

- USER_SDO_GEOR_SYSDATA contains system data for all GeoRaster objects owned by the current user.

- ALL_SDO_GEOR_SYSDATA contains system data for all GeoRaster objects accessible by the current user.

The GeoRaster system data table and the USER_SDO_GEOR_SYSDATA and ALL_SDO_GEOR_SYSDATA views should never be modified directly by users, although they are updated by the DML trigger that you must create on each SDO_GEORASTER column in each GeoRaster table. (For information about using GeoRaster triggers, see Section 3.1.1).

The USER_SDO_GEOR_SYSDATA view has the following definition:

    (
       TABLE_NAME            VARCHAR2(32),
       COLUMN_NAME           VARCHAR2(1024),
       METADATA_COLUMN_NAME  VARCHAR2(1024),
       RDT_TABLE_NAME        VARCHAR2(32),
       RASTER_ID             NUMBER,
       OTHER_TABLE_NAMES     SDO_STRING_ARRAY
    );

The ALL_SDO_GEOR_SYSDATA view has all columns in the USER_SDO_GEOR_SYSDATA view, but it also has an OWNER column identifying the schema that owns the table specified in the TABLE_NAME column.

This section describes each of the columns common to both views. Note that for VARCHAR2 data in any columns, names are stored in all uppercase characters.

### 2.4.1 TABLE_NAME Column

The TABLE_NAME column contains the name of a GeoRaster table that has at least one column of type SDO_GEORASTER.

### 2.4.2 COLUMN_NAME Column

The COLUMN_NAME column contains the name of a column of type SDO_GEORASTER in the GeoRaster table specified in the TABLE_NAME column.

### 2.4.3 METADATA_COLUMN_NAME Column

The METADATA_COLUMN_NAME column is ignored for the current release.

### 2.4.4 RDT_TABLE_NAME Column

The RDT_TABLE_NAME column contains the name of the raster data table associated with the table and column specified in the TABLE_NAME and COLUMN_NAME columns. (The raster data table is explained in Section 2.2.)

### 2.4.5 RASTER_ID Column

The RASTER_ID column contains a number that, together with the RDT_TABLE_NAME column value, uniquely identifies each GeoRaster object.

### 2.4.6 OTHER_TABLE_NAMES Column

The OTHER_TABLE_NAMES column is ignored for the current release.

## 2.5 GeoRaster XML Schema Table

GeoRaster uses a table named SDO_GEOR_XMLSCHEMA_TABLE to store the GeoRaster metadata XML schema and other information. This table is under the MDSYS schema, and you must include the schema name if you reference this table. For example:

    DESCRIBE mdsys.sdo_geor_xmlschema_table
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ID                                        NOT NULL NUMBER
     GEORASTERFORMAT                                    VARCHAR2(1024)
     XMLSCHEMA                                          CLOB

Table 2-5 describes the columns of the SDO_GEOR_XMLSCHEMA_TABLE table.

Table 2-5 SDO_GEOR_XMLSCHEMA_TABLE Table Columns

Column Name | Data Type | Description
--- | --- | ---
id | NUMBER | ID number, assigned by Oracle.
georasterFormat | VARCHAR2(1024) | GeoRaster format identifier, assigned by Oracle.
xmlSchema | CLOB | GeoRaster metadata XML schema definition. This definition is included in Appendix A.

There are no GeoRaster views defined on this table. It is mainly of interest to advanced users who might want to query the table.

You are encouraged not to modify the contents of this table, unless you want to define your own XML schema for other metadata that is not included in the GeoRaster XML schema, and to store that metadata in a new row in this table. If you add a row for your own metadata, do not use an ID column value of `1` or a GEORASTERFORMAT column value of `GEORASTER`, because these column values are reserved for use by Oracle.